home *** CD-ROM | disk | FTP | other *** search
/ Internet Info 1994 March / Internet Info CD-ROM (Walnut Creek) (March 1994).iso / security / crack_4.1-tar / Scripts / do_join < prev    next >
Encoding:
Text File  |  1992-06-25  |  1.9 KB  |  114 lines

  1. #!/bin/sh
  2.  
  3. ###
  4. # This program is copyright Alec Muffett 1991, and is provided as part of
  5. # the Crack v4.0 Password Cracking package.  The author disclaims all
  6. # responsibility or liability with respect to it's usage or its effect
  7. # upon hardware or computer systems, and maintains copyright as set out in
  8. # the "LICENCE" document which accompanies distributions of Crack v4.0 and
  9. # upwards. So there...
  10. ###
  11.  
  12. ###
  13. # Empty the output file, Error if cannot create
  14. ###
  15.  
  16. warn=$1
  17. shift
  18. cp /dev/null $warn || exit 1
  19.  
  20. ###
  21. # Have we got feedback ?
  22. ###
  23.  
  24. fbkfiles=`sh -c "echo Runtime/F*"`
  25. if [ "$fbkfiles" = "Runtime/F*" ]
  26. then
  27.     fbkfiles=""
  28. fi
  29.  
  30. ###
  31. # As Walt Disney would say, we start with a simple bracket:-
  32. ###
  33.  
  34. (
  35.     if [ "$fbkfiles" != "" ]
  36.     then
  37.         cat $fbkfiles
  38.     fi
  39.  
  40.     (
  41.         for file in $*
  42.         do
  43.             awk '/^[A-Za-z0-9]/ {print "'"$file"':" $0}' < $file
  44.         done
  45.     ) |
  46.     sort -t: +2
  47. ) |
  48. awk -F: '
  49. BEGIN {
  50.     FS = ":";
  51.     numf = 8;        # number of fields in a pwent, + 1
  52.     warn="'"$warn"'";
  53.     date = "'"`date`"'";
  54.     date = substr(date, 5, 15);
  55. }
  56.  
  57. /^!fb!/ {
  58.     if ($3 == "N")
  59.     {
  60.         guessable[$2] = "N";
  61.     } else if ($3 == "Y")
  62.     {
  63.         guessable[$2] = "Y";
  64.         decrypt[$2] = $4;
  65.     } else
  66.     {
  67.         print "Strange feedback: ", $0 >> "/dev/tty";
  68.     }
  69.     next;
  70. }
  71.  
  72. NF != numf {
  73.     printf("join: Rejected '%s': does not have %d fields\n", \
  74.         $0, numf) >> warn;
  75.     next;
  76. }
  77.  
  78. $3 == "" {
  79.     printf("join: %s Warning! %s (%s in %s) has a NULL password!\n", \
  80.         date, $2, $7, $1) >> warn;
  81.     next;
  82. }
  83.  
  84. index($3, "*") != 0 || \
  85. index($3, "!") != 0 || \
  86. index($3, " ") != 0 {
  87.     printf("join: %s User %s (in %s) has a locked password:- %s\n", \
  88.         date, $2, $1, $3) >> warn;
  89.     next;
  90. }
  91.  
  92. {
  93.     if (guessable[$3] == "N")
  94.     {
  95.         next;
  96.     } else if (guessable[$3] == "Y")
  97.     {
  98.         if ($4 == 0)
  99.         {
  100.             msg = "ROOT PASSWORD ";
  101.         } else
  102.         {
  103.             msg = "";
  104.         }
  105.         printf("join: %s Guessed %s%s (%s in %s) [%s] %s\n", \
  106.             date, msg, $2, $8, $1, decrypt[$3], $3) >> warn;
  107.     } else
  108.     {
  109.         print $0;
  110.     }
  111. }'
  112.  
  113. exit 0
  114.